<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<t:base type="jquery,easyui,tools"/>
<div class="easyui-layout" fit="true">
    <div region="center" style="padding:1px;">
        <t:datagrid name="ccourseList" title=""
                    actionUrl="ccourseController.do?datagrid_course" idField="id" fit="true"
                    queryMode="group">
            <t:dgCol title="id" field="id" hidden="true"></t:dgCol>
            <t:dgCol title="课程名称" field="name" query="true" width="1"></t:dgCol>
            <t:dgCol title="栏目" field="columnsEntity.title" query="true" width="1"></t:dgCol>
            <t:dgCol title="系列" field="courseSeriesEntity.name" query="true" width="1"></t:dgCol>
            <t:dgCol title="导师" field="consultantEntity.aCustomerEntity.realname" query="true" width="1"></t:dgCol>
            <t:dgCol title="课程单价" field="price" width="1"></t:dgCol>
            <t:dgCol title="订单人数" field="personNum" width="1"></t:dgCol>
            <t:dgCol title="是否有效" field="effective" dictionary="isno" width="1" query="true"></t:dgCol>
            <t:dgCol title="首页显示" field="homeShow" dictionary="isno" width="1" query="true"></t:dgCol>

            <t:dgCol title="common.operation" field="opt" width="1"></t:dgCol>
            <t:dgDelOpt url="ccourseController.do?del_course&id={id}" title="删除"></t:dgDelOpt>
            <%--<t:dgFunOpt title="评价信息" funname="showComment(id,name)" ></t:dgFunOpt>--%>

            <t:dgToolBar title="新增" icon="icon-add"
                         url="ccourseController.do?addorupdate_course&consultantId=${consultantId}"
                         funname="add" width="700"
                         height="600"></t:dgToolBar>
            <t:dgToolBar title="修改" icon="icon-edit" url="ccourseController.do?addorupdate_course" funname="update"
                         width="700"
                         height="600"></t:dgToolBar>
            <%--<t:dgToolBar title="预览" langArg="common.user" icon="icon-search" url="bankController.do?bankController&id=" funname="f_openPreview"  width="850" height="600"></t:dgToolBar>--%>
            <%--<t:dgToolBar title="查看" icon="icon-search" url="sArticleController.do?addorupdate&search=search" funname="detail"  width="800" height="630"></t:dgToolBar>--%>
        </t:datagrid>
    </div>
</div>
<script type="text/javascript">
    function update(title, url, id, width, height) {
        gridname = id;
        var rowsData = $('#' + id).datagrid('getSelections');
        if (!rowsData || rowsData.length == 0) {
            tip('请选择编辑课程');
            return;
        }
        if (rowsData.length > 1) {
            tip('请选择一条记录再编辑');
            return;
        }

        url += '&id=' + rowsData[0].id;
        createwindow(title, url, width, height);
    }

//    function showComment(id, name) {
//        var title = name;
//        var url = "ccourseController.do?courseCommentIndex&courseId=" + id;
//        createwindow(title, url, window.innerWidth,window.innerHeight);
//    }
</script>
